
use std::fs;
use serde::Deserialize;

// 定义RPC配置结构体
#[derive(Deserialize)]
pub struct Config {
    pub rpc: RpcConfig,
}

// 定义RPC配置结构体
#[derive(Deserialize)]
pub struct RpcConfig {
    pub host: String,
    pub client_certificate: String,
    pub client_key: String,
    pub server_certificate: String,
}

// 解析RPC配置文件，配置文件类型为toml类型
pub fn parse_config(path: &str) -> Config {
    let config_text = fs::read_to_string(path).expect("Failed to read config file");
    toml::from_str(&config_text).expect("Failed to parse config file")
}